<html>
 <head>
  <meta charset="utf-8"/>
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"/>
  <title>
   卡尔曼滤波器算法浅析及matlab实战  | 数螺 | NAUT IDEA
  </title>
  <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" rel="stylesheet"/>
  <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
  <style type="text/css">
   #xmain img {
                  max-width: 100%;
                  display: block;
                  margin-top: 10px;
                  margin-bottom: 10px;
                }

                #xmain p {
                    line-height:150%;
                    font-size: 16px;
                    margin-top: 20px;
                }

                #xmain h2 {
                    font-size: 24px;
                }

                #xmain h3 {
                    font-size: 20px;
                }

                #xmain h4 {
                    font-size: 18px;
                }


                .header {
	           background-color: #0099ff;
	           color: #ffffff;
	           margin-bottom: 20px;
	        }

	        .header p {
                  margin: 0px;
                  padding: 10px 0;
                  display: inline-block;  
                  vertical-align: middle;
                  font-size: 16px;
               }

               .header a {
                 color: white;
               }

              .header img {
                 height: 25px;
              }
  </style>
  <script src="http://cdn.bootcss.com/jquery/3.0.0/jquery.min.js">
  </script>
  <script src="http://nautstatic-10007657.file.myqcloud.com/static/css/readability.min.js" type="text/javascript">
  </script>
  <script type="text/javascript">
   $(document).ready(function() {
                 var loc = document.location;
                 var uri = {
                  spec: "http://dataunion.org/17335.html",
                  host: "http://dataunion.org",
                  prePath: "http://dataunion.org",
                  scheme: "http",
                  pathBase: "http://dataunion.org/"
                 };
    
                 var documentClone = document.cloneNode(true);
                 var article = new Readability(uri, documentClone).parse();
     
                 document.getElementById("xmain").innerHTML = article.content;
                });
  </script>
  <!-- 1466461407: Accept with keywords: (title(0.5):滤波器,算法,数盟,社区, topn(0.5):滤波器,社区,估算,方差,横轴,残差,增益,实际,状态,纵轴,对系统,例子,文章,速度,数据,预测,公式,画点,噪声,数盟,初始化,协方差,算法,矩阵,时刻,最优化,误差,初始状态,系统,假设).-->
 </head>
 <body onload="">
  <div class="header">
   <div class="container">
    <div class="row">
     <div class="col-xs-6 col-sm-6 text-left">
      <a href="/databee">
       <img src="http://nautidea-10007657.cos.myqcloud.com/logo_white.png"/>
      </a>
      <a href="/databee">
       <p>
        数螺
       </p>
      </a>
     </div>
     <div class="hidden-xs col-sm-6 text-right">
      <p>
       致力于数据科学的推广和知识传播
      </p>
     </div>
    </div>
   </div>
  </div>
  <div class="container text-center">
   <h1>
    卡尔曼滤波器算法浅析及matlab实战
   </h1>
  </div>
  <div class="container" id="xmain">
   ﻿﻿
   <title>
    卡尔曼滤波器算法浅析及matlab实战 | 数盟社区
   </title>
   <!-- All in One SEO Pack 2.2.7.6.2 by Michael Torbert of Semper Fi Web Design[32,66] -->
   <!-- /all in one seo pack -->
   <!--
<div align="center">
<a href="http://strata.oreilly.com.cn/hadoop-big-data-cn?cmp=mp-data-confreg-home-stcn16_dataunion_pc" target="_blank"><img src="http://dataunion.org/wp-content/uploads/2016/05/stratabj.jpg"/ ></a>
</div>
-->
   <header id="header-web">
    <div class="header-main">
     <hgroup class="logo">
      <h1>
       <a href="http://dataunion.org/" rel="home" title="数盟社区">
        <img src="http://dataunion.org/wp-content/themes/yzipi/images/logo.png"/>
       </a>
      </h1>
     </hgroup>
     <!--logo-->
     <nav class="header-nav">
      <ul class="menu" id="menu-%e4%b8%bb%e8%8f%9c%e5%8d%95">
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-71" id="menu-item-71">
        <a href="http://dataunion.org/category/events" title="events">
         活动
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-22457" id="menu-item-22457">
          <a href="http://dataunion.org/2016timeline">
           2016档期
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-22459" id="menu-item-22459">
          <a href="http://dataunion.org/category/parterc">
           合作会议
          </a>
         </li>
        </ul>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category current-post-ancestor current-menu-parent current-post-parent menu-item-has-children menu-item-20869" id="menu-item-20869">
        <a href="http://dataunion.org/category/tech" title="articles">
         文章
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-20867" id="menu-item-20867">
          <a href="http://dataunion.org/category/tech/base" title="base">
           基础架构
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3302" id="menu-item-3302">
          <a href="http://dataunion.org/category/tech/ai" title="ai">
           人工智能
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3303" id="menu-item-3303">
          <a href="http://dataunion.org/category/tech/analysis" title="analysis">
           数据分析
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-21920" id="menu-item-21920">
          <a href="http://dataunion.org/category/tech/dm">
           数据挖掘
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3314" id="menu-item-3314">
          <a href="http://dataunion.org/category/tech/viz" title="viz">
           可视化
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3305" id="menu-item-3305">
          <a href="http://dataunion.org/category/tech/devl" title="devl">
           编程语言
          </a>
         </li>
        </ul>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-20876" id="menu-item-20876">
        <a href="http://dataunion.org/category/industry">
         行业
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-16328" id="menu-item-16328">
          <a href="http://dataunion.org/category/industry/case" title="case">
           行业应用
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-2112" id="menu-item-2112">
          <a href="http://dataunion.org/category/industry/demo" title="demo">
           Demo展示
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-21562" id="menu-item-21562">
          <a href="http://dataunion.org/category/industry/news">
           行业资讯
          </a>
         </li>
        </ul>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-311" id="menu-item-311">
        <a href="http://dataunion.org/category/sources" title="sources">
         资源
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-20870" id="menu-item-20870">
        <a href="http://dataunion.org/category/books" title="book">
         图书
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-21363" id="menu-item-21363">
        <a href="http://dataunion.org/category/training">
         课程
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-21853" id="menu-item-21853">
        <a href="http://dataunion.org/category/jobs">
         职位
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-22050" id="menu-item-22050">
          <a href="http://dataunion.org/category/career">
           职业规划
          </a>
         </li>
        </ul>
       </li>
      </ul>
     </nav>
     <!--header-nav-->
    </div>
   </header>
   <!--header-web-->
   <div id="main">
    <div id="soutab">
     <form action="http://dataunion.org/" class="search" method="get">
     </form>
    </div>
    <div id="container">
     <nav id="mbx">
      当前位置：
      <a href="http://dataunion.org">
       首页
      </a>
      &gt;
      <a href="http://dataunion.org/category/tech">
       文章
      </a>
      &gt;  正文
     </nav>
     <!--mbx-->
     <article class="content">
      <header align="centre" class="contenttitle">
       <div class="mscc">
        <h1 class="mscctitle">
         <a href="http://dataunion.org/17335.html">
          卡尔曼滤波器算法浅析及matlab实战
         </a>
        </h1>
        <address class="msccaddress ">
         <em>
          5,242 次阅读 -
         </em>
         <a href="http://dataunion.org/category/tech" rel="category tag">
          文章
         </a>
        </address>
       </div>
      </header>
      <div class="content-text">
       <blockquote>
        <div align="center" style="text-align: left;">
         <span style="font-size: 12pt;">
          <span style="font-size: 12pt;">
           作者：
           <a href="http://blog.csdn.net/llp1992">
            Liu_LongPo
           </a>
           出处：
          </span>
         </span>
         <a href="http://blog.csdn.net/llp1992/article/details/45370025">
          Liu_LongPo的博客
         </a>
        </div>
       </blockquote>
       <p>
        <span style="font-size: medium;">
         卡尔曼滤波器是一种利用线性系统状态方程，通过系统输入输出观测数据，对系统状态进行最优估计的算法。而且由于观测包含系统的噪声和干扰的影响，所以最优估计也可看做是滤波过程。
        </span>
       </p>
       <p>
        <span style="font-size: medium;">
         卡尔曼滤波器的核心内容就是5条公式，计算简单快速，适合用于少量数据的预测和估计。
        </span>
       </p>
       <p>
        <span style="font-size: medium;">
         下面我们用一个例子来说明一下卡尔曼算法的应用。
        </span>
       </p>
       <p>
        <span style="font-size: medium;">
         假设我们想在有一辆小车，在 t 时刻其速度为 Vt ，位置坐标为 Pt，ut 表示 t 时刻的加速度，那么我们可以用Xt表示 t 时刻的状态，如下：
        </span>
       </p>
       <div align="center">
        <a href="http://dataunion.org/wp-content/uploads/2015/05/20150429170221083.png">
         <img src="http://dataunion.org/wp-content/uploads/2015/05/20150429170221083.png"/>
        </a>
       </div>
       <p>
        <span style="font-size: medium;">
         则我们可以得到，由t-1 时刻到 t 时刻，位置以及速度的转换如下：
        </span>
       </p>
       <div align="center">
        <a href="http://dataunion.org/wp-content/uploads/2015/05/20150429170420564.png">
         <img src="http://dataunion.org/wp-content/uploads/2015/05/20150429170420564.png"/>
        </a>
       </div>
       <p>
        <span style="font-size: medium;">
         用向量表示上述转换过程，如下：
        </span>
       </p>
       <div align="center">
        <a href="http://dataunion.org/wp-content/uploads/2015/05/20150429170434040.png">
         <img src="http://dataunion.org/wp-content/uploads/2015/05/20150429170434040.png"/>
        </a>
       </div>
       <p>
        <span style="font-size: medium;">
         如下图：
        </span>
       </p>
       <div align="center">
        <a href="http://dataunion.org/wp-content/uploads/2015/05/20150429170616875.jpg">
         <img src="http://dataunion.org/wp-content/uploads/2015/05/20150429170616875.jpg"/>
        </a>
       </div>
       <p>
        <span style="font-size: medium;">
         那么我们可以得到如下的状态转移公式：
        </span>
       </p>
       <div align="center">
        <a href="http://dataunion.org/wp-content/uploads/2015/05/20150429170735562.png">
         <img src="http://dataunion.org/wp-content/uploads/2015/05/20150429170735562.png"/>
        </a>
        (1)
       </div>
       <p>
        <span style="font-size: medium;">
         其中矩阵 F 为状态转移矩阵，表示如何从上一状态来推测当前时刻的状态，B 为控制矩阵，表示控制量u如何作用于当前矩阵，上面的公式 x 有顶帽子，表示只是估计值，并不是最优的。
        </span>
       </p>
       <p>
        <span style="font-size: medium;">
         有了状态转移公式就可以用来推测当前的状态，但是所有的推测都是包含噪声的，噪声越大，不确定越大，协方差矩阵用来表示这次推测带来的不确定性
        </span>
       </p>
       <h2 id="协方差矩阵">
        <p name="t0">
        </p>
        协方差矩阵
       </h2>
       <p>
        <span style="font-size: medium;">
         假设我们有一个一维的数据，这个数据每次测量都不同，我们假设服从高斯分布，那么我们可以用均值和方差来表示该数据集，我们将该一维数据集投影到坐标轴上，如下图：
        </span>
       </p>
       <div align="center">
        <a href="http://dataunion.org/wp-content/uploads/2015/05/20150429170856511.jpg">
         <img src="http://dataunion.org/wp-content/uploads/2015/05/20150429170856511.jpg"/>
        </a>
       </div>
       <p>
        <span style="font-size: medium;">
         可以看到，服从高斯分布的一维数据大部分分布在均值附近。
        </span>
       </p>
       <p>
        <span style="font-size: medium;">
         现在我们来看看服从高斯分布的二维数据投影到坐标轴的情况，如下图：
        </span>
       </p>
       <div align="center">
        <a href="http://dataunion.org/wp-content/uploads/2015/05/20150429170850350.jpg">
         <img src="http://dataunion.org/wp-content/uploads/2015/05/20150429170850350.jpg"/>
        </a>
       </div>
       <p>
        <span style="font-size: medium;">
         二维数据比一维数据稍微复杂一点，投影后有3种情况，分别是：
         <br/>
         左图：两个维的数据互不相关；
         <br/>
         中图：两个维的数据正相关，也就是 y 随着 x 的增大而增大（假设两个维分别为 x 和 y）
         <br/>
         右图：两个维的数据负相关，也就是 y 随着 x 的增大而减小。
        </span>
       </p>
       <p>
        <span style="font-size: medium;">
         那怎么来表示两个维的数据的相关性呢？答案就是协方差矩阵。
        </span>
       </p>
       <div align="center">
        <a href="http://dataunion.org/wp-content/uploads/2015/05/20150429170939085.jpg">
         <img src="http://dataunion.org/wp-content/uploads/2015/05/20150429170939085.jpg"/>
        </a>
       </div>
       <p>
        <a href="http://dataunion.org/wp-content/uploads/2015/05/20150429171012266.png">
         <img src="http://dataunion.org/wp-content/uploads/2015/05/20150429171012266.png"/>
        </a>
       </p>
       <h2 id="状态协方差矩阵传递">
        <p name="t1">
        </p>
        状态协方差矩阵传递
       </h2>
       <p>
        <span style="font-size: medium;">
         在公式（1）之中，我们已经得到了状态的转移公式，但是由上面可知，二维数据的协方差矩阵对于描述数据的特征是很重要的，那么我们应该如何更新或者说传递我们的二维数据的协方差矩阵呢？假如我们用 P 来表示状态协方差，即
        </span>
       </p>
       <div align="center">
        <a href="http://dataunion.org/wp-content/uploads/2015/05/20150429171402333.png">
         <img src="http://dataunion.org/wp-content/uploads/2015/05/20150429171402333.png"/>
        </a>
       </div>
       <p>
        <span style="font-size: medium;">
         那么加入状态转换矩阵 F ，得到
        </span>
       </p>
       <div align="center">
        <a href="http://dataunion.org/wp-content/uploads/2015/05/20150429171401665.png">
         <img src="http://dataunion.org/wp-content/uploads/2015/05/20150429171401665.png"/>
        </a>
        (2)
       </div>
       <p>
        <span style="font-size: medium;">
         也即：
        </span>
       </p>
       <div align="center">
        <a href="http://dataunion.org/wp-content/uploads/2015/05/20150429171550083.jpg">
         <img src="http://dataunion.org/wp-content/uploads/2015/05/20150429171550083.jpg"/>
        </a>
       </div>
       <p>
        <span style="font-size: medium;">
         因此我们便得到了协方差的转换公式。
        </span>
       </p>
       <p>
        <span style="font-size: medium;">
         现在我们得到了两个公式，运用这两个公式能够对现在状态进行预测。按照我们的正常思路来理解，预测结果不一定会对嘛，肯定有误差。而且在我们大多数回归算法或者是拟合算法中，一般思路都是先预测，然后看看这个预测结果跟实际结果的误差有多大，再根据这个误差来调整预测函数的参数，不断迭代调整参数直到预测误差小于一定的阈值。
        </span>
       </p>
       <p>
        <span style="font-size: medium;">
         卡尔曼算法的迭代思想也类似，不过这里根据误差调整的是状态 X 。
        </span>
       </p>
       <p>
        <span style="font-size: medium;">
         在这里，我们的实际数据就是 Z， 如下图：
        </span>
       </p>
       <div align="center">
        <a href="http://dataunion.org/wp-content/uploads/2015/05/20150429171642842.jpg">
         <img src="http://dataunion.org/wp-content/uploads/2015/05/20150429171642842.jpg"/>
        </a>
       </div>
       <p>
        <span style="font-size: medium;">
         其中，矩阵 H 为测量系统的参数，即观察矩阵，v 为观测噪声， 其协方差矩阵为R
        </span>
       </p>
       <p>
        <span style="font-size: medium;">
         那么我们的状态更新公式如下：
        </span>
       </p>
       <div align="center">
        <a href="http://dataunion.org/wp-content/uploads/2015/05/20150429171733683.jpg">
         <img src="http://dataunion.org/wp-content/uploads/2015/05/20150429171733683.jpg"/>
        </a>
       </div>
       <p>
        <span style="font-size: medium;">
         其中K 为卡尔曼系数， Z-Hx 则为残差，也就是我们说的，预测值与实际值的误差。
        </span>
       </p>
       <p>
        <span style="font-size: medium;">
         <strong>
          K的作用：
         </strong>
        </span>
       </p>
       <blockquote>
        <p>
         1.K 权衡预测协方差P和观察协方差矩阵R那个更加重要，相信预测，残差的权重小，相信观察，残差权重大，由 K 的表达是可以退出这个结论
         <br/>
         2,将残差的表现形式从观察域转换到状态域（残差与一个标量，通过K 转换为向量），由 状态 X 的更新公式可得到该结论。
        </p>
       </blockquote>
       <p>
        <span style="font-size: medium;">
         至此，我们已经得到了 t 状态下的最优估计值 Xt。但为了能让我们的迭代算法持续下去，我们还必须更新状态协方差的值。
        </span>
       </p>
       <h2 id="状态协方差的更新">
        <p name="t2">
        </p>
        状态协方差的更新
       </h2>
       <div align="center">
        <a href="http://dataunion.org/wp-content/uploads/2015/05/20150429171756679.jpg">
         <img src="http://dataunion.org/wp-content/uploads/2015/05/20150429171756679.jpg"/>
        </a>
       </div>
       <p>
        以上就是卡尔曼滤波算法的思想，只有简单的 5 条公式，总结如下：
       </p>
       <div align="center">
        <a href="http://dataunion.org/wp-content/uploads/2015/05/20150429171945971.jpg">
         <img src="http://dataunion.org/wp-content/uploads/2015/05/20150429171945971.jpg"/>
        </a>
       </div>
       <h2 id="matlab-实现">
        <p name="t3">
        </p>
        Matlab 实现
       </h2>
       <p>
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686cdc2c376813328687" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          &lt;span class="hljs-function"&gt;&lt;span class="hljs-keyword"&gt;function&lt;/span&gt; &lt;span class="hljs-title"&gt;kalmanFiltering&lt;/span&gt;&lt;/span&gt;
&lt;span class="hljs-comment"&gt;%%&lt;/span&gt;
clc
close all

&lt;span class="hljs-comment"&gt;%%&lt;/span&gt;
&lt;span class="hljs-comment"&gt;%&lt;/span&gt;
&lt;span class="hljs-comment"&gt;%   Description : kalmanFiltering&lt;/span&gt;
&lt;span class="hljs-comment"&gt;%   Author : Liulongpo&lt;/span&gt;
&lt;span class="hljs-comment"&gt;%   Time：2015-4-29 16:42:34&lt;/span&gt;
&lt;span class="hljs-comment"&gt;%&lt;/span&gt;

&lt;span class="hljs-comment"&gt;%%&lt;/span&gt;
Z=(&lt;span class="hljs-number"&gt;1&lt;/span&gt;:&lt;span class="hljs-number"&gt;2&lt;/span&gt;:&lt;span class="hljs-number"&gt;200&lt;/span&gt;); &lt;span class="hljs-comment"&gt;%观测值  汽车的位置  也就是我们要修改的量&lt;/span&gt;
noise=&lt;span class="hljs-built_in"&gt;randn&lt;/span&gt;(&lt;span class="hljs-number"&gt;1&lt;/span&gt;,&lt;span class="hljs-number"&gt;100&lt;/span&gt;); &lt;span class="hljs-comment"&gt;%方差为1的高斯噪声&lt;/span&gt;
Z=Z+noise;
X=&lt;span class="hljs-matrix"&gt;[&lt;span class="hljs-number"&gt;0&lt;/span&gt; ; &lt;span class="hljs-number"&gt;0&lt;/span&gt; ]&lt;/span&gt;; &lt;span class="hljs-comment"&gt;%初始状态&lt;/span&gt;
P=&lt;span class="hljs-matrix"&gt;[&lt;span class="hljs-number"&gt;1&lt;/span&gt; &lt;span class="hljs-number"&gt;0&lt;/span&gt;;&lt;span class="hljs-number"&gt;0&lt;/span&gt; &lt;span class="hljs-number"&gt;1&lt;/span&gt;]&lt;/span&gt;; &lt;span class="hljs-comment"&gt;%状态协方差矩阵&lt;/span&gt;
F=&lt;span class="hljs-matrix"&gt;[&lt;span class="hljs-number"&gt;1&lt;/span&gt; &lt;span class="hljs-number"&gt;1&lt;/span&gt;;&lt;span class="hljs-number"&gt;0&lt;/span&gt; &lt;span class="hljs-number"&gt;1&lt;/span&gt;]&lt;/span&gt;; &lt;span class="hljs-comment"&gt;%状态转移矩阵&lt;/span&gt;
Q=&lt;span class="hljs-matrix"&gt;[&lt;span class="hljs-number"&gt;0.0001&lt;/span&gt;,&lt;span class="hljs-number"&gt;0&lt;/span&gt;;&lt;span class="hljs-number"&gt;0&lt;/span&gt; , &lt;span class="hljs-number"&gt;0.0001&lt;/span&gt;]&lt;/span&gt;; &lt;span class="hljs-comment"&gt;%状态转移协方差矩阵&lt;/span&gt;
H=&lt;span class="hljs-matrix"&gt;[&lt;span class="hljs-number"&gt;1&lt;/span&gt;,&lt;span class="hljs-number"&gt;0&lt;/span&gt;]&lt;/span&gt;; &lt;span class="hljs-comment"&gt;%观测矩阵&lt;/span&gt;
R=&lt;span class="hljs-number"&gt;1&lt;/span&gt;; &lt;span class="hljs-comment"&gt;%观测噪声方差&lt;/span&gt;
figure;
hold on;
&lt;span class="hljs-keyword"&gt;for&lt;/span&gt; &lt;span class="hljs-built_in"&gt;i&lt;/span&gt; = &lt;span class="hljs-number"&gt;1&lt;/span&gt;:&lt;span class="hljs-number"&gt;100&lt;/span&gt;
&lt;span class="hljs-comment"&gt;%基于上一状态预测当前状态  &lt;/span&gt;
X_ = F*X;
&lt;span class="hljs-comment"&gt;% 更新协方差  Q系统过程的协方差  这两个公式是对系统的预测&lt;/span&gt;
P_ = F*P*&lt;span class="hljs-transposed_variable"&gt;F'&lt;/span&gt;+Q;
&lt;span class="hljs-comment"&gt;% 计算卡尔曼增益&lt;/span&gt;
K = P_*&lt;span class="hljs-transposed_variable"&gt;H'&lt;/span&gt;/(H*P_*&lt;span class="hljs-transposed_variable"&gt;H'&lt;/span&gt;+R);
&lt;span class="hljs-comment"&gt;% 得到当前状态的最优化估算值  增益乘以残差&lt;/span&gt;
X = X_+K*(Z(&lt;span class="hljs-built_in"&gt;i&lt;/span&gt;)-H*X_);
&lt;span class="hljs-comment"&gt;%更新K状态的协方差&lt;/span&gt;
P = (&lt;span class="hljs-built_in"&gt;eye&lt;/span&gt;(&lt;span class="hljs-number"&gt;2&lt;/span&gt;)-K*H)*P_;
scatter(X(&lt;span class="hljs-number"&gt;1&lt;/span&gt;), X(&lt;span class="hljs-number"&gt;2&lt;/span&gt;),&lt;span class="hljs-number"&gt;4&lt;/span&gt;); &lt;span class="hljs-comment"&gt;%画点，横轴表示位置，纵轴表示速度&lt;/span&gt;
&lt;span class="hljs-keyword"&gt;end&lt;/span&gt;

&lt;span class="hljs-keyword"&gt;end&lt;/span&gt;
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-57686cdc2c376813328687-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c376813328687-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c376813328687-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c376813328687-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c376813328687-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c376813328687-6">
               6
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c376813328687-7">
               7
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c376813328687-8">
               8
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c376813328687-9">
               9
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c376813328687-10">
               10
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c376813328687-11">
               11
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c376813328687-12">
               12
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c376813328687-13">
               13
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c376813328687-14">
               14
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c376813328687-15">
               15
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c376813328687-16">
               16
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c376813328687-17">
               17
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c376813328687-18">
               18
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c376813328687-19">
               19
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c376813328687-20">
               20
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c376813328687-21">
               21
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c376813328687-22">
               22
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c376813328687-23">
               23
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c376813328687-24">
               24
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c376813328687-25">
               25
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c376813328687-26">
               26
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c376813328687-27">
               27
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c376813328687-28">
               28
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c376813328687-29">
               29
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c376813328687-30">
               30
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c376813328687-31">
               31
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c376813328687-32">
               32
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c376813328687-33">
               33
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c376813328687-34">
               34
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c376813328687-35">
               35
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c376813328687-36">
               36
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c376813328687-37">
               37
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c376813328687-38">
               38
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c376813328687-39">
               39
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-57686cdc2c376813328687-1">
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-function"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-keyword"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-t">
                function
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-title"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-v">
                kalmanFiltering
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c376813328687-2">
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-comment"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                %
               </span>
               <span class="crayon-o">
                %
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c376813328687-3">
               <span class="crayon-e">
                clc
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c376813328687-4">
               <span class="crayon-e">
                close
               </span>
               <span class="crayon-v">
                all
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c376813328687-5">
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c376813328687-6">
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-comment"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                %
               </span>
               <span class="crayon-o">
                %
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c376813328687-7">
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-comment"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                %
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c376813328687-8">
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-comment"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                %
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                Description
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                kalmanFiltering
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c376813328687-9">
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-comment"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                %
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                Author
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                Liulongpo
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c376813328687-10">
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-comment"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                %
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-i">
                Time
               </span>
               ：
               <span class="crayon-cn">
                2015
               </span>
               <span class="crayon-o">
                -
               </span>
               <span class="crayon-cn">
                4
               </span>
               <span class="crayon-o">
                -
               </span>
               <span class="crayon-cn">
                29
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                16
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-cn">
                42
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-cn">
                34
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c376813328687-11">
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-comment"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                %
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c376813328687-12">
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c376813328687-13">
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-comment"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                %
               </span>
               <span class="crayon-o">
                %
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c376813328687-14">
               <span class="crayon-v">
                Z
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                200
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-comment"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                %
               </span>
               观测值
               <span class="crayon-h">
               </span>
               汽车的位置
               <span class="crayon-h">
               </span>
               也就是我们要修改的量
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c376813328687-15">
               <span class="crayon-v">
                noise
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-built_in"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-v">
                randn
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                100
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-comment"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                %
               </span>
               方差为
               <span class="crayon-cn">
                1
               </span>
               的高斯噪声
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c376813328687-16">
               <span class="crayon-v">
                Z
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-v">
                Z
               </span>
               <span class="crayon-o">
                +
               </span>
               <span class="crayon-v">
                noise
               </span>
               <span class="crayon-sy">
                ;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c376813328687-17">
               <span class="crayon-v">
                X
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-matrix"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-comment"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                %
               </span>
               初始状态
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c376813328687-18">
               <span class="crayon-v">
                P
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-matrix"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-comment"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                %
               </span>
               状态协方差矩阵
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c376813328687-19">
               <span class="crayon-v">
                F
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-matrix"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-comment"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                %
               </span>
               状态转移矩阵
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c376813328687-20">
               <span class="crayon-v">
                Q
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-matrix"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                0.0001
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                0.0001
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-comment"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                %
               </span>
               状态转移协方差矩阵
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c376813328687-21">
               <span class="crayon-v">
                H
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-matrix"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-comment"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                %
               </span>
               观测矩阵
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c376813328687-22">
               <span class="crayon-v">
                R
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-comment"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                %
               </span>
               观测噪声方差
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c376813328687-23">
               <span class="crayon-v">
                figure
               </span>
               <span class="crayon-sy">
                ;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c376813328687-24">
               <span class="crayon-e">
                hold
               </span>
               <span class="crayon-v">
                on
               </span>
               <span class="crayon-sy">
                ;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c376813328687-25">
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-keyword"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-st">
                for
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-built_in"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-v">
                i
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                100
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c376813328687-26">
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-comment"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                %
               </span>
               基于上一状态预测当前状态
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c376813328687-27">
               <span class="crayon-v">
                X_
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e ">
                F*
               </span>
               <span class="crayon-v">
                X
               </span>
               <span class="crayon-sy">
                ;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c376813328687-28">
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-comment"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                %
               </span>
               <span class="crayon-h">
               </span>
               更新协方差
               <span class="crayon-h">
               </span>
               <span class="crayon-i">
                Q
               </span>
               系统过程的协方差
               <span class="crayon-h">
               </span>
               这两个公式是对系统的预测
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c376813328687-29">
               <span class="crayon-v">
                P_
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e ">
                F*
               </span>
               <span class="crayon-e ">
                P*
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-transposed_variable"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-i">
                F
               </span>
               <span class="crayon-s">
                '&lt;/span&gt;+Q;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c376813328687-30">
               <span class="crayon-s">
                &lt;span class="hljs-comment"&gt;% 计算卡尔曼增益&lt;/span&gt;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c376813328687-31">
               <span class="crayon-s">
                K = P_*&lt;span class="hljs-transposed_variable"&gt;H'
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-e ">
                H*
               </span>
               <span class="crayon-e ">
                P_*
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-transposed_variable"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-i">
                H
               </span>
               '
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                +
               </span>
               <span class="crayon-v">
                R
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c376813328687-32">
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-comment"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                %
               </span>
               <span class="crayon-h">
               </span>
               得到当前状态的最优化估算值
               <span class="crayon-h">
               </span>
               增益乘以残差
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c376813328687-33">
               <span class="crayon-v">
                X
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                X_
               </span>
               <span class="crayon-o">
                +
               </span>
               <span class="crayon-e ">
                K*
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-e">
                Z
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-built_in"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-v">
                i
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                -
               </span>
               <span class="crayon-e ">
                H*
               </span>
               <span class="crayon-v">
                X_
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c376813328687-34">
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-comment"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                %
               </span>
               更新
               <span class="crayon-i">
                K
               </span>
               状态的协方差
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c376813328687-35">
               <span class="crayon-v">
                P
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-built_in"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-v">
                eye
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                -
               </span>
               <span class="crayon-e ">
                K*
               </span>
               <span class="crayon-v">
                H
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                *
               </span>
               <span class="crayon-v">
                P_
               </span>
               <span class="crayon-sy">
                ;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c376813328687-36">
               <span class="crayon-e">
                scatter
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-e">
                X
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                X
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                4
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-comment"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                %
               </span>
               画点，横轴表示位置，纵轴表示速度
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c376813328687-37">
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-keyword"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-st">
                end
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c376813328687-38">
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c376813328687-39">
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-keyword"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-st">
                end
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0641 seconds] -->
       <p>
       </p>
       <h2 id="效果如下">
        <p name="t4">
        </p>
        效果如下
       </h2>
       <div align="center">
        <a href="http://dataunion.org/wp-content/uploads/2015/05/20150429172103363.png">
         <img src="http://dataunion.org/wp-content/uploads/2015/05/20150429172103363.png"/>
        </a>
       </div>
       <p>
        <span style="font-size: medium;">
         其中 x 轴为位置，y轴为速度。
         <br/>
         在代码中，我们设定x的变化是 1:2:200，则速度就是2，可以由上图看到，值经过几次迭代，速度就基本上在 2 附近摆动，摆动的原因是我们加入了噪声。
        </span>
       </p>
       <p>
        <span style="font-size: medium;">
         接下来来看一个实际例子。
        </span>
       </p>
       <p>
        <span style="font-size: medium;">
         我们的数据为 data = [149.360 , 150.06, 151.44, 152.81,154.19 ,157.72];
         <br/>
         <span style="font-size: medium;">
          这是运用光流法从视频中获取角点的实际x轴坐标，总共有6个数据，也就是代表了一个点的连续6帧的x轴坐标。接下来这个例子，我们将实现用5帧的数据进行训练，然后预测出第6帧的x轴坐标。
         </span>
        </span>
       </p>
       <p>
        <span style="font-size: medium;">
         在上一个matlab例子中，我们的训练数据比较多，因此我们的初始状态设置为[0,0]，也就是位置为0，速度为0，在训练数据比较多的情况下，初始化数据为0并没有关系，因为我们在上面的效果图中可以看到，算法的经过短暂的迭代就能够发挥作用。
        </span>
       </p>
       <p>
        <span style="font-size: medium;">
         但在这里，我们的训练数据只有5帧，所以为了加快训练，我们将位置状态初始化为第一帧的位置，速度初始化为第二帧与第一帧之差。
        </span>
       </p>
       <h2 id="代码如下">
        <p name="t5">
        </p>
        代码如下：
       </h2>
       <p>
        <strong>
         KF.m
        </strong>
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686cdc2c38c120988085" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          &lt;span class="hljs-function"&gt;&lt;span class="hljs-keyword"&gt;function&lt;/span&gt; &lt;span class="hljs-params"&gt;[predData,dataX]&lt;/span&gt; = &lt;span class="hljs-title"&gt;KF&lt;/span&gt;&lt;span class="hljs-params"&gt;(dataZ)&lt;/span&gt;&lt;/span&gt;

&lt;span class="hljs-comment"&gt;%%&lt;/span&gt;
&lt;span class="hljs-comment"&gt;%&lt;/span&gt;
&lt;span class="hljs-comment"&gt;%   Description : kalmanFiltering&lt;/span&gt;
&lt;span class="hljs-comment"&gt;%   Author : Liulongpo&lt;/span&gt;
&lt;span class="hljs-comment"&gt;%   Time：2015-4-29 16:42:34&lt;/span&gt;
&lt;span class="hljs-comment"&gt;%&lt;/span&gt;
&lt;span class="hljs-comment"&gt;%%&lt;/span&gt;
Z = &lt;span class="hljs-transposed_variable"&gt;dataZ'&lt;/span&gt;;
len = &lt;span class="hljs-built_in"&gt;length&lt;/span&gt;(Z);
&lt;span class="hljs-comment"&gt;%Z=(1:2:200); %观测值  汽车的位置  也就是我们要修改的量&lt;/span&gt;
noise=&lt;span class="hljs-built_in"&gt;randn&lt;/span&gt;(&lt;span class="hljs-number"&gt;1&lt;/span&gt;,len); &lt;span class="hljs-comment"&gt;%方差为1的高斯噪声&lt;/span&gt;
dataX = &lt;span class="hljs-built_in"&gt;zeros&lt;/span&gt;(&lt;span class="hljs-number"&gt;2&lt;/span&gt;,len);
Z=Z+noise;
X=&lt;span class="hljs-matrix"&gt;[Z(&lt;span class="hljs-number"&gt;1&lt;/span&gt;) ; Z(&lt;span class="hljs-number"&gt;2&lt;/span&gt;)-Z(&lt;span class="hljs-number"&gt;1&lt;/span&gt;) ]&lt;/span&gt;; &lt;span class="hljs-comment"&gt;%初始状态  分别为 位置 和速度&lt;/span&gt;
P=&lt;span class="hljs-matrix"&gt;[&lt;span class="hljs-number"&gt;1&lt;/span&gt; &lt;span class="hljs-number"&gt;0&lt;/span&gt;;&lt;span class="hljs-number"&gt;0&lt;/span&gt; &lt;span class="hljs-number"&gt;1&lt;/span&gt;]&lt;/span&gt;; &lt;span class="hljs-comment"&gt;%状态协方差矩阵&lt;/span&gt;
F=&lt;span class="hljs-matrix"&gt;[&lt;span class="hljs-number"&gt;1&lt;/span&gt; &lt;span class="hljs-number"&gt;1&lt;/span&gt;;&lt;span class="hljs-number"&gt;0&lt;/span&gt; &lt;span class="hljs-number"&gt;1&lt;/span&gt;]&lt;/span&gt;; &lt;span class="hljs-comment"&gt;%状态转移矩阵&lt;/span&gt;
Q=&lt;span class="hljs-matrix"&gt;[&lt;span class="hljs-number"&gt;0.0001&lt;/span&gt;,&lt;span class="hljs-number"&gt;0&lt;/span&gt;;&lt;span class="hljs-number"&gt;0&lt;/span&gt; , &lt;span class="hljs-number"&gt;0.0001&lt;/span&gt;]&lt;/span&gt;; &lt;span class="hljs-comment"&gt;%状态转移协方差矩阵&lt;/span&gt;
H=&lt;span class="hljs-matrix"&gt;[&lt;span class="hljs-number"&gt;1&lt;/span&gt;,&lt;span class="hljs-number"&gt;0&lt;/span&gt;]&lt;/span&gt;; &lt;span class="hljs-comment"&gt;%观测矩阵&lt;/span&gt;
R=&lt;span class="hljs-number"&gt;1&lt;/span&gt;; &lt;span class="hljs-comment"&gt;%观测噪声方差&lt;/span&gt;
&lt;span class="hljs-comment"&gt;%figure;&lt;/span&gt;
&lt;span class="hljs-comment"&gt;%hold on;&lt;/span&gt;
&lt;span class="hljs-keyword"&gt;for&lt;/span&gt; &lt;span class="hljs-built_in"&gt;i&lt;/span&gt; = &lt;span class="hljs-number"&gt;1&lt;/span&gt;:len
&lt;span class="hljs-comment"&gt;%基于上一状态预测当前状态  &lt;/span&gt;
&lt;span class="hljs-comment"&gt;% 2x1  2x1&lt;/span&gt;
X_ = F*X;
&lt;span class="hljs-comment"&gt;% 更新协方差  Q系统过程的协方差  这两个公式是对系统的预测&lt;/span&gt;
&lt;span class="hljs-comment"&gt;%   2x1  2x1  1x2  2x2&lt;/span&gt;
P_ = F*P*&lt;span class="hljs-transposed_variable"&gt;F'&lt;/span&gt;+Q;
&lt;span class="hljs-comment"&gt;% 计算卡尔曼增益&lt;/span&gt;
K = P_*&lt;span class="hljs-transposed_variable"&gt;H'&lt;/span&gt;/(H*P_*&lt;span class="hljs-transposed_variable"&gt;H'&lt;/span&gt;+R);
&lt;span class="hljs-comment"&gt;% 得到当前状态的最优化估算值  增益乘以残差&lt;/span&gt;
X = X_+K*(Z(&lt;span class="hljs-built_in"&gt;i&lt;/span&gt;)-H*X_);
&lt;span class="hljs-comment"&gt;%更新K状态的协方差&lt;/span&gt;
P = (&lt;span class="hljs-built_in"&gt;eye&lt;/span&gt;(&lt;span class="hljs-number"&gt;2&lt;/span&gt;)-K*H)*P_;
dataX(:,&lt;span class="hljs-built_in"&gt;i&lt;/span&gt;) = &lt;span class="hljs-matrix"&gt;[X(&lt;span class="hljs-number"&gt;1&lt;/span&gt;);X(&lt;span class="hljs-number"&gt;2&lt;/span&gt;)]&lt;/span&gt;;
&lt;span class="hljs-comment"&gt;%scatter(X(1), X(2),4); %画点，横轴表示位置，纵轴表示速度&lt;/span&gt;
&lt;span class="hljs-keyword"&gt;end&lt;/span&gt;
predData = F*X;
&lt;span class="hljs-keyword"&gt;end&lt;/span&gt;
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-57686cdc2c38c120988085-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c38c120988085-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c38c120988085-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c38c120988085-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c38c120988085-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c38c120988085-6">
               6
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c38c120988085-7">
               7
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c38c120988085-8">
               8
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c38c120988085-9">
               9
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c38c120988085-10">
               10
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c38c120988085-11">
               11
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c38c120988085-12">
               12
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c38c120988085-13">
               13
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c38c120988085-14">
               14
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c38c120988085-15">
               15
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c38c120988085-16">
               16
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c38c120988085-17">
               17
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c38c120988085-18">
               18
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c38c120988085-19">
               19
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c38c120988085-20">
               20
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c38c120988085-21">
               21
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c38c120988085-22">
               22
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c38c120988085-23">
               23
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c38c120988085-24">
               24
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c38c120988085-25">
               25
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c38c120988085-26">
               26
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c38c120988085-27">
               27
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c38c120988085-28">
               28
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c38c120988085-29">
               29
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c38c120988085-30">
               30
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c38c120988085-31">
               31
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c38c120988085-32">
               32
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c38c120988085-33">
               33
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c38c120988085-34">
               34
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c38c120988085-35">
               35
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c38c120988085-36">
               36
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c38c120988085-37">
               37
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c38c120988085-38">
               38
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c38c120988085-39">
               39
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c38c120988085-40">
               40
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c38c120988085-41">
               41
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-57686cdc2c38c120988085-1">
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-function"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-keyword"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-t">
                function
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-params"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-v">
                predData
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                dataX
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-title"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-v">
                KF
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-params"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                dataZ
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c38c120988085-2">
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c38c120988085-3">
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-comment"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                %
               </span>
               <span class="crayon-o">
                %
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c38c120988085-4">
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-comment"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                %
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c38c120988085-5">
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-comment"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                %
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                Description
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                kalmanFiltering
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c38c120988085-6">
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-comment"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                %
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                Author
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                Liulongpo
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c38c120988085-7">
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-comment"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                %
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-i">
                Time
               </span>
               ：
               <span class="crayon-cn">
                2015
               </span>
               <span class="crayon-o">
                -
               </span>
               <span class="crayon-cn">
                4
               </span>
               <span class="crayon-o">
                -
               </span>
               <span class="crayon-cn">
                29
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                16
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-cn">
                42
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-cn">
                34
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c38c120988085-8">
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-comment"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                %
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c38c120988085-9">
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-comment"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                %
               </span>
               <span class="crayon-o">
                %
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c38c120988085-10">
               <span class="crayon-v">
                Z
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-transposed_variable"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-i">
                dataZ
               </span>
               <span class="crayon-s">
                '&lt;/span&gt;;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c38c120988085-11">
               <span class="crayon-s">
                len = &lt;span class="hljs-built_in"&gt;length&lt;/span&gt;(Z);
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c38c120988085-12">
               <span class="crayon-s">
                &lt;span class="hljs-comment"&gt;%Z=(1:2:200); %观测值  汽车的位置  也就是我们要修改的量&lt;/span&gt;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c38c120988085-13">
               <span class="crayon-s">
                noise=&lt;span class="hljs-built_in"&gt;randn&lt;/span&gt;(&lt;span class="hljs-number"&gt;1&lt;/span&gt;,len); &lt;span class="hljs-comment"&gt;%方差为1的高斯噪声&lt;/span&gt;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c38c120988085-14">
               <span class="crayon-s">
                dataX = &lt;span class="hljs-built_in"&gt;zeros&lt;/span&gt;(&lt;span class="hljs-number"&gt;2&lt;/span&gt;,len);
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c38c120988085-15">
               <span class="crayon-s">
                Z=Z+noise;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c38c120988085-16">
               <span class="crayon-s">
                X=&lt;span class="hljs-matrix"&gt;[Z(&lt;span class="hljs-number"&gt;1&lt;/span&gt;) ; Z(&lt;span class="hljs-number"&gt;2&lt;/span&gt;)-Z(&lt;span class="hljs-number"&gt;1&lt;/span&gt;) ]&lt;/span&gt;; &lt;span class="hljs-comment"&gt;%初始状态  分别为 位置 和速度&lt;/span&gt;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c38c120988085-17">
               <span class="crayon-s">
                P=&lt;span class="hljs-matrix"&gt;[&lt;span class="hljs-number"&gt;1&lt;/span&gt; &lt;span class="hljs-number"&gt;0&lt;/span&gt;;&lt;span class="hljs-number"&gt;0&lt;/span&gt; &lt;span class="hljs-number"&gt;1&lt;/span&gt;]&lt;/span&gt;; &lt;span class="hljs-comment"&gt;%状态协方差矩阵&lt;/span&gt;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c38c120988085-18">
               <span class="crayon-s">
                F=&lt;span class="hljs-matrix"&gt;[&lt;span class="hljs-number"&gt;1&lt;/span&gt; &lt;span class="hljs-number"&gt;1&lt;/span&gt;;&lt;span class="hljs-number"&gt;0&lt;/span&gt; &lt;span class="hljs-number"&gt;1&lt;/span&gt;]&lt;/span&gt;; &lt;span class="hljs-comment"&gt;%状态转移矩阵&lt;/span&gt;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c38c120988085-19">
               <span class="crayon-s">
                Q=&lt;span class="hljs-matrix"&gt;[&lt;span class="hljs-number"&gt;0.0001&lt;/span&gt;,&lt;span class="hljs-number"&gt;0&lt;/span&gt;;&lt;span class="hljs-number"&gt;0&lt;/span&gt; , &lt;span class="hljs-number"&gt;0.0001&lt;/span&gt;]&lt;/span&gt;; &lt;span class="hljs-comment"&gt;%状态转移协方差矩阵&lt;/span&gt;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c38c120988085-20">
               <span class="crayon-s">
                H=&lt;span class="hljs-matrix"&gt;[&lt;span class="hljs-number"&gt;1&lt;/span&gt;,&lt;span class="hljs-number"&gt;0&lt;/span&gt;]&lt;/span&gt;; &lt;span class="hljs-comment"&gt;%观测矩阵&lt;/span&gt;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c38c120988085-21">
               <span class="crayon-s">
                R=&lt;span class="hljs-number"&gt;1&lt;/span&gt;; &lt;span class="hljs-comment"&gt;%观测噪声方差&lt;/span&gt;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c38c120988085-22">
               <span class="crayon-s">
                &lt;span class="hljs-comment"&gt;%figure;&lt;/span&gt;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c38c120988085-23">
               <span class="crayon-s">
                &lt;span class="hljs-comment"&gt;%hold on;&lt;/span&gt;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c38c120988085-24">
               <span class="crayon-s">
                &lt;span class="hljs-keyword"&gt;for&lt;/span&gt; &lt;span class="hljs-built_in"&gt;i&lt;/span&gt; = &lt;span class="hljs-number"&gt;1&lt;/span&gt;:len
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c38c120988085-25">
               <span class="crayon-s">
                &lt;span class="hljs-comment"&gt;%基于上一状态预测当前状态  &lt;/span&gt;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c38c120988085-26">
               <span class="crayon-s">
                &lt;span class="hljs-comment"&gt;% 2x1  2x1&lt;/span&gt;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c38c120988085-27">
               <span class="crayon-s">
                X_ = F*X;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c38c120988085-28">
               <span class="crayon-s">
                &lt;span class="hljs-comment"&gt;% 更新协方差  Q系统过程的协方差  这两个公式是对系统的预测&lt;/span&gt;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c38c120988085-29">
               <span class="crayon-s">
                &lt;span class="hljs-comment"&gt;%   2x1  2x1  1x2  2x2&lt;/span&gt;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c38c120988085-30">
               <span class="crayon-s">
                P_ = F*P*&lt;span class="hljs-transposed_variable"&gt;F'
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                +
               </span>
               <span class="crayon-v">
                Q
               </span>
               <span class="crayon-sy">
                ;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c38c120988085-31">
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-comment"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                %
               </span>
               <span class="crayon-h">
               </span>
               计算卡尔曼增益
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c38c120988085-32">
               <span class="crayon-v">
                K
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e ">
                P_*
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-transposed_variable"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-i">
                H
               </span>
               <span class="crayon-s">
                '&lt;/span&gt;/(H*P_*&lt;span class="hljs-transposed_variable"&gt;H'
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                +
               </span>
               <span class="crayon-v">
                R
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c38c120988085-33">
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-comment"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                %
               </span>
               <span class="crayon-h">
               </span>
               得到当前状态的最优化估算值
               <span class="crayon-h">
               </span>
               增益乘以残差
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c38c120988085-34">
               <span class="crayon-v">
                X
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                X_
               </span>
               <span class="crayon-o">
                +
               </span>
               <span class="crayon-e ">
                K*
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-e">
                Z
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-built_in"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-v">
                i
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                -
               </span>
               <span class="crayon-e ">
                H*
               </span>
               <span class="crayon-v">
                X_
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c38c120988085-35">
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-comment"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                %
               </span>
               更新
               <span class="crayon-i">
                K
               </span>
               状态的协方差
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c38c120988085-36">
               <span class="crayon-v">
                P
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-built_in"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-v">
                eye
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                -
               </span>
               <span class="crayon-e ">
                K*
               </span>
               <span class="crayon-v">
                H
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-o">
                *
               </span>
               <span class="crayon-v">
                P_
               </span>
               <span class="crayon-sy">
                ;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c38c120988085-37">
               <span class="crayon-e">
                dataX
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-built_in"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-v">
                i
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-matrix"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-e">
                X
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-e">
                X
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                ;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c38c120988085-38">
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-comment"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                %
               </span>
               <span class="crayon-e">
                scatter
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-e">
                X
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                X
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                4
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                %
               </span>
               画点，横轴表示位置，纵轴表示速度
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c38c120988085-39">
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-keyword"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-st">
                end
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c38c120988085-40">
               <span class="crayon-v">
                predData
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e ">
                F*
               </span>
               <span class="crayon-v">
                X
               </span>
               <span class="crayon-sy">
                ;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c38c120988085-41">
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-keyword"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-st">
                end
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0156 seconds] -->
       <p>
        <strong>
         testKF.m
        </strong>
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-57686cdc2c397153796646" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          &lt;span class="hljs-function"&gt;&lt;span class="hljs-keyword"&gt;function&lt;/span&gt; &lt;span class="hljs-title"&gt;testKF&lt;/span&gt;&lt;/span&gt;
&lt;span class="hljs-comment"&gt;%% &lt;/span&gt;
clc
close all
&lt;span class="hljs-comment"&gt;%%&lt;/span&gt;
&lt;span class="hljs-comment"&gt;%data = load('D:\\a.txt');&lt;/span&gt;
&lt;span class="hljs-comment"&gt;%data = [149.360 , 150.06, 151.44, 152.81,154.19,157.72,157.47,159.33,153.66];&lt;/span&gt;
data = &lt;span class="hljs-matrix"&gt;[&lt;span class="hljs-number"&gt;149.360&lt;/span&gt; , &lt;span class="hljs-number"&gt;150.06&lt;/span&gt;, &lt;span class="hljs-number"&gt;151.44&lt;/span&gt;, &lt;span class="hljs-number"&gt;152.81&lt;/span&gt;,&lt;span class="hljs-number"&gt;154.19&lt;/span&gt; ,&lt;span class="hljs-number"&gt;157.72&lt;/span&gt;]&lt;/span&gt;;
&lt;span class="hljs-matrix"&gt;[predData , DataX]&lt;/span&gt; = KF(&lt;span class="hljs-transposed_variable"&gt;data'&lt;/span&gt;);
error = DataX(&lt;span class="hljs-number"&gt;1&lt;/span&gt;,:) - data;

&lt;span class="hljs-built_in"&gt;i&lt;/span&gt; = &lt;span class="hljs-number"&gt;1&lt;/span&gt;:&lt;span class="hljs-built_in"&gt;length&lt;/span&gt;(data);
figure
subplot &lt;span class="hljs-number"&gt;311&lt;/span&gt;
scatter(&lt;span class="hljs-built_in"&gt;i&lt;/span&gt;,data,&lt;span class="hljs-number"&gt;3&lt;/span&gt;),title(&lt;span class="hljs-string"&gt;'原始数据'&lt;/span&gt;)
subplot &lt;span class="hljs-number"&gt;312&lt;/span&gt;
scatter(&lt;span class="hljs-built_in"&gt;i&lt;/span&gt;,DataX(&lt;span class="hljs-number"&gt;1&lt;/span&gt;,:),&lt;span class="hljs-number"&gt;3&lt;/span&gt;),title(&lt;span class="hljs-string"&gt;'预测数据'&lt;/span&gt;)
subplot &lt;span class="hljs-number"&gt;313&lt;/span&gt;
scatter(&lt;span class="hljs-built_in"&gt;i&lt;/span&gt;,error,&lt;span class="hljs-number"&gt;3&lt;/span&gt;),title(&lt;span class="hljs-string"&gt;'预测误差'&lt;/span&gt;)
predData(&lt;span class="hljs-number"&gt;1&lt;/span&gt;)
&lt;span class="hljs-comment"&gt;%{&lt;/span&gt;
scatter(&lt;span class="hljs-built_in"&gt;i&lt;/span&gt;,error,&lt;span class="hljs-number"&gt;3&lt;/span&gt;);
figure
scatter(&lt;span class="hljs-built_in"&gt;i&lt;/span&gt;,data,&lt;span class="hljs-number"&gt;3&lt;/span&gt;)
figure
scatter(&lt;span class="hljs-built_in"&gt;i&lt;/span&gt;,predData(&lt;span class="hljs-number"&gt;1&lt;/span&gt;,:),&lt;span class="hljs-number"&gt;3&lt;/span&gt;)
&lt;span class="hljs-comment"&gt;%}&lt;/span&gt;
&lt;span class="hljs-keyword"&gt;end&lt;/span&gt;
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-57686cdc2c397153796646-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c397153796646-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c397153796646-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c397153796646-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c397153796646-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c397153796646-6">
               6
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c397153796646-7">
               7
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c397153796646-8">
               8
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c397153796646-9">
               9
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c397153796646-10">
               10
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c397153796646-11">
               11
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c397153796646-12">
               12
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c397153796646-13">
               13
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c397153796646-14">
               14
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c397153796646-15">
               15
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c397153796646-16">
               16
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c397153796646-17">
               17
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c397153796646-18">
               18
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c397153796646-19">
               19
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c397153796646-20">
               20
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c397153796646-21">
               21
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c397153796646-22">
               22
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c397153796646-23">
               23
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c397153796646-24">
               24
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c397153796646-25">
               25
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c397153796646-26">
               26
              </div>
              <div class="crayon-num" data-line="crayon-57686cdc2c397153796646-27">
               27
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-57686cdc2c397153796646-28">
               28
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-57686cdc2c397153796646-1">
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-function"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-keyword"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-t">
                function
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-title"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-v">
                testKF
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c397153796646-2">
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-comment"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                %
               </span>
               <span class="crayon-o">
                %
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c397153796646-3">
               <span class="crayon-e">
                clc
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c397153796646-4">
               <span class="crayon-e">
                close
               </span>
               <span class="crayon-v">
                all
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c397153796646-5">
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-comment"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                %
               </span>
               <span class="crayon-o">
                %
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c397153796646-6">
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-comment"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                %
               </span>
               <span class="crayon-v">
                data
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                load
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-s">
                'D:\\a.txt'
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c397153796646-7">
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-comment"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                %
               </span>
               <span class="crayon-v">
                data
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-cn">
                149.360
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                150.06
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                151.44
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                152.81
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                154.19
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                157.72
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                157.47
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                159.33
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                153.66
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c397153796646-8">
               <span class="crayon-v">
                data
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-matrix"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                149.360
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                150.06
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                151.44
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                152.81
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                154.19
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                157.72
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                ;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c397153796646-9">
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-matrix"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-i">
                predData
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                DataX
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                KF
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-transposed_variable"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-i">
                data
               </span>
               <span class="crayon-s">
                '&lt;/span&gt;);
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c397153796646-10">
               <span class="crayon-s">
                error = DataX(&lt;span class="hljs-number"&gt;1&lt;/span&gt;,:) - data;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c397153796646-11">
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c397153796646-12">
               <span class="crayon-s">
                &lt;span class="hljs-built_in"&gt;i&lt;/span&gt; = &lt;span class="hljs-number"&gt;1&lt;/span&gt;:&lt;span class="hljs-built_in"&gt;length&lt;/span&gt;(data);
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c397153796646-13">
               <span class="crayon-s">
                figure
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c397153796646-14">
               <span class="crayon-s">
                subplot &lt;span class="hljs-number"&gt;311&lt;/span&gt;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c397153796646-15">
               <span class="crayon-s">
                scatter(&lt;span class="hljs-built_in"&gt;i&lt;/span&gt;,data,&lt;span class="hljs-number"&gt;3&lt;/span&gt;),title(&lt;span class="hljs-string"&gt;'
               </span>
               原始数据
               <span class="crayon-s">
                '&lt;/span&gt;)
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c397153796646-16">
               <span class="crayon-s">
                subplot &lt;span class="hljs-number"&gt;312&lt;/span&gt;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c397153796646-17">
               <span class="crayon-s">
                scatter(&lt;span class="hljs-built_in"&gt;i&lt;/span&gt;,DataX(&lt;span class="hljs-number"&gt;1&lt;/span&gt;,:),&lt;span class="hljs-number"&gt;3&lt;/span&gt;),title(&lt;span class="hljs-string"&gt;'
               </span>
               预测数据
               <span class="crayon-s">
                '&lt;/span&gt;)
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c397153796646-18">
               <span class="crayon-s">
                subplot &lt;span class="hljs-number"&gt;313&lt;/span&gt;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c397153796646-19">
               <span class="crayon-s">
                scatter(&lt;span class="hljs-built_in"&gt;i&lt;/span&gt;,error,&lt;span class="hljs-number"&gt;3&lt;/span&gt;),title(&lt;span class="hljs-string"&gt;'
               </span>
               预测误差'
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c397153796646-20">
               <span class="crayon-e">
                predData
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c397153796646-21">
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-comment"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                %
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c397153796646-22">
               <span class="crayon-e">
                scatter
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-built_in"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-v">
                i
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                error
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                3
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ;
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c397153796646-23">
               <span class="crayon-e">
                figure
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c397153796646-24">
               <span class="crayon-e">
                scatter
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-built_in"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-v">
                i
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                data
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                3
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c397153796646-25">
               <span class="crayon-e">
                figure
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c397153796646-26">
               <span class="crayon-e">
                scatter
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-built_in"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-v">
                i
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-e">
                predData
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-number"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-cn">
                3
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-57686cdc2c397153796646-27">
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-comment"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-o">
                %
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-57686cdc2c397153796646-28">
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-e">
                span
               </span>
               <span class="crayon-t">
                class
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                "hljs-keyword"
               </span>
               <span class="crayon-o">
                &gt;
               </span>
               <span class="crayon-st">
                end
               </span>
               <span class="crayon-o">
                &lt;
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                span
               </span>
               <span class="crayon-o">
                &gt;
               </span>
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0136 seconds] -->
       <p>
       </p>
       <h2 id="效果如下-1">
        <p name="t6">
        </p>
        效果如下：
       </h2>
       <div align="center">
        <a href="http://dataunion.org/wp-content/uploads/2015/05/20150429172238585.png">
         <img src="http://dataunion.org/wp-content/uploads/2015/05/20150429172238585.png"/>
        </a>
       </div>
       <p>
        <span style="font-size: medium;">
         预测结果为： 155.7493 ，跟实际结果 157.72 仅有1.9 的误差，可以看到，卡尔曼滤波器算法对于少量数据的预测效果还是挺不错的。当然，预测位置的同时，我们也得到了预测速度。
        </span>
       </p>
       <p>
        <span style="font-size: medium;">
         参考文献：
         <a href="http://v.youku.com/v_show/id_XNzQwMTMwOTQ0.html">
          视频: 卡尔曼滤波的原理以及在MATLAB中的实现
         </a>
        </span>
       </p>
      </div>
      <div>
       <strong>
        注：转载文章均来自于公开网络，仅供学习使用，不会用于任何商业用途，如果侵犯到原作者的权益，请您与我们联系删除或者授权事宜，联系邮箱：contact@dataunion.org。转载数盟网站文章请注明原文章作者，否则产生的任何版权纠纷与数盟无关。
       </strong>
      </div>
      <!--content_text-->
      <div class="fenxian">
       <!-- JiaThis Button BEGIN -->
       <div class="jiathis_style_32x32">
        <p class="jiathis_button_weixin">
        </p>
        <p class="jiathis_button_tsina">
        </p>
        <p class="jiathis_button_qzone">
        </p>
        <p class="jiathis_button_cqq">
        </p>
        <p class="jiathis_button_tumblr">
        </p>
        <a class="jiathis jiathis_txt jtico jtico_jiathis" href="http://www.jiathis.com/share" target="_blank">
        </a>
        <p class="jiathis_counter_style">
        </p>
       </div>
       <!-- JiaThis Button END -->
      </div>
     </article>
     <!--content-->
     <!--相关文章-->
     <div class="xianguan">
      <div class="xianguantitle">
       相关文章！
      </div>
      <ul class="pic">
       <li>
        <a href="http://dataunion.org/24220.html">
         <img src="http://dataunion.org/wp-content/uploads/2016/05/100910rrxp5plglxk4lcle-291x200.png"/>
        </a>
        <a class="link" href="http://dataunion.org/24220.html" rel="bookmark" title="520大数据：八成男性期待被表白 “套路”也是爱">
         520大数据：八成男性期待被表白 “套路”也是爱
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/23785.html">
         <img src="http://dataunion.org/wp-content/uploads/2016/04/u7145986293872240263fm21gp0-298x200.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/23785.html" rel="bookmark" title="Docker安全基准：22项新增要点概述">
         Docker安全基准：22项新增要点概述
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/23703.html">
         <img src="http://dataunion.org/wp-content/uploads/2016/04/1317020-300x163.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/23703.html" rel="bookmark" title="推荐：五个不容错过的数据科学家博客">
         推荐：五个不容错过的数据科学家博客
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/23507.html">
         <img src="http://dataunion.org/wp-content/uploads/2016/03/110606wjpugdldig4idddn.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/23507.html" rel="bookmark" title="解密深度学习在智能推荐系统的实践与应用">
         解密深度学习在智能推荐系统的实践与应用
        </a>
       </li>
      </ul>
     </div>
     <!--相关文章-->
     <div class="comment" id="comments">
      <!-- You can start editing here. -->
      <!-- If comments are open, but there are no comments. -->
      <div class="title">
       期待你一针见血的评论，Come on！
      </div>
      <div id="respond">
       <p>
        不用想啦，马上
        <a href="http://dataunion.org/wp-login.php?redirect_to=http%3A%2F%2Fdataunion.org%2F17335.html">
         "登录"
        </a>
        发表自已的想法.
       </p>
      </div>
     </div>
     <!-- .nav-single -->
    </div>
    <!--Container End-->
    <aside id="sitebar">
     <div class="sitebar_list2">
      <div class="wptag">
       <span class="tagtitle">
        热门标签+
       </span>
       <div class="tagg">
        <ul class="menu" id="menu-%e5%8f%8b%e6%83%85%e9%93%be%e6%8e%a5">
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-1605" id="menu-item-1605">
          <a href="http://taidizh.com/">
           泰迪智慧
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-20884" id="menu-item-20884">
          <a href="http://www.transwarp.cn/">
           星环科技
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-3538" id="menu-item-3538">
          <a href="http://datall.org/">
           珈和遥感
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-20888" id="menu-item-20888">
          <a href="http://www.chinahadoop.cn/">
           小象学院
          </a>
         </li>
        </ul>
       </div>
      </div>
     </div>
     <div class="sitebar_list">
      <div class="textwidget">
       <div align="center">
        <a href="http://study.163.com/course/courseMain.htm?courseId=991022" target="_blank">
         <img src="http://dataunion.org/wp-content/uploads/2016/03/dv.jpg"/>
        </a>
       </div>
      </div>
     </div>
     <div class="sitebar_list">
      <h4 class="sitebar_title">
       文章分类
      </h4>
      <div class="tagcloud">
       <a class="tag-link-44" href="http://dataunion.org/category/industry/demo" style="font-size: 10.204724409449pt;" title="4个话题">
        Demo展示
       </a>
       <a class="tag-link-31" href="http://dataunion.org/category/experts" style="font-size: 15.826771653543pt;" title="52个话题">
        专家团队
       </a>
       <a class="tag-link-870" href="http://dataunion.org/category/tech/ai" style="font-size: 19.795275590551pt;" title="273个话题">
        人工智能
       </a>
       <a class="tag-link-488" href="http://dataunion.org/category/%e5%8a%a0%e5%85%a5%e6%95%b0%e7%9b%9f" style="font-size: 8pt;" title="1个话题">
        加入数盟
       </a>
       <a class="tag-link-869" href="http://dataunion.org/category/tech/viz" style="font-size: 17.204724409449pt;" title="93个话题">
        可视化
       </a>
       <a class="tag-link-30" href="http://dataunion.org/category/partners" style="font-size: 10.645669291339pt;" title="5个话题">
        合作伙伴
       </a>
       <a class="tag-link-889" href="http://dataunion.org/category/parterc" style="font-size: 11.582677165354pt;" title="8个话题">
        合作会议
       </a>
       <a class="tag-link-104" href="http://dataunion.org/category/books" style="font-size: 12.96062992126pt;" title="15个话题">
        图书
       </a>
       <a class="tag-link-220" href="http://dataunion.org/category/tech/base" style="font-size: 19.850393700787pt;" title="281个话题">
        基础架构
       </a>
       <a class="tag-link-219" href="http://dataunion.org/category/tech/analysis" style="font-size: 19.409448818898pt;" title="232个话题">
        数据分析
       </a>
       <a class="tag-link-887" href="http://dataunion.org/category/tech/dm" style="font-size: 13.291338582677pt;" title="17个话题">
        数据挖掘
       </a>
       <a class="tag-link-34" href="http://dataunion.org/category/tech" style="font-size: 20.732283464567pt;" title="404个话题">
        文章
       </a>
       <a class="tag-link-1" href="http://dataunion.org/category/uncategorized" style="font-size: 22pt;" title="693个话题">
        未分类
       </a>
       <a class="tag-link-4" href="http://dataunion.org/category/events" style="font-size: 14.503937007874pt;" title="29个话题">
        活动
       </a>
       <a class="tag-link-890" href="http://dataunion.org/category/tech/%e6%b7%b1%e5%ba%a6%e5%ad%a6%e4%b9%a0" style="font-size: 10.204724409449pt;" title="4个话题">
        深度学习
       </a>
       <a class="tag-link-221" href="http://dataunion.org/category/tech/devl" style="font-size: 18.968503937008pt;" title="193个话题">
        编程语言
       </a>
       <a class="tag-link-888" href="http://dataunion.org/category/career" style="font-size: 15.661417322835pt;" title="48个话题">
        职业规划
       </a>
       <a class="tag-link-5" href="http://dataunion.org/category/jobs" style="font-size: 14.11811023622pt;" title="25个话题">
        职位
       </a>
       <a class="tag-link-871" href="http://dataunion.org/category/industry" style="font-size: 15.716535433071pt;" title="49个话题">
        行业
       </a>
       <a class="tag-link-613" href="http://dataunion.org/category/industry/case" style="font-size: 16.984251968504pt;" title="84个话题">
        行业应用
       </a>
       <a class="tag-link-885" href="http://dataunion.org/category/industry/news" style="font-size: 17.425196850394pt;" title="102个话题">
        行业资讯
       </a>
       <a class="tag-link-10" href="http://dataunion.org/category/training" style="font-size: 14.228346456693pt;" title="26个话题">
        课程
       </a>
       <a class="tag-link-16" href="http://dataunion.org/category/sources" style="font-size: 15.661417322835pt;" title="48个话题">
        资源
       </a>
      </div>
     </div>
     <div class="sitebar_list">
      <h4 class="sitebar_title">
       功能
      </h4>
      <ul>
       <li>
        <a href="http://dataunion.org/wp-login.php?action=register">
         注册
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/wp-login.php">
         登录
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/feed">
         文章
         <abbr title="Really Simple Syndication">
          RSS
         </abbr>
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/comments/feed">
         评论
         <abbr title="Really Simple Syndication">
          RSS
         </abbr>
        </a>
       </li>
       <li>
        <a href="https://cn.wordpress.org/" title="基于WordPress，一个优美、先进的个人信息发布平台。">
         WordPress.org
        </a>
       </li>
      </ul>
     </div>
    </aside>
    <div class="clear">
    </div>
   </div>
   <!--main-->
   ﻿
   <footer id="dibu">
    <div class="about">
     <div class="right">
      <ul class="menu" id="menu-%e5%ba%95%e9%83%a8%e8%8f%9c%e5%8d%95">
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-18024" id="menu-item-18024">
        <a href="http://dataunion.org/category/partners">
         合作伙伴
        </a>
       </li>
       <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-20881" id="menu-item-20881">
        <a href="http://dataunion.org/contribute">
         文章投稿
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-20872" id="menu-item-20872">
        <a href="http://dataunion.org/category/%e5%8a%a0%e5%85%a5%e6%95%b0%e7%9b%9f">
         加入数盟
        </a>
       </li>
       <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-22441" id="menu-item-22441">
        <a href="http://dataunion.org/f-links">
         友情链接
        </a>
       </li>
       <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-20874" id="menu-item-20874">
        <a href="http://dataunion.org/aboutus">
         关于数盟
        </a>
       </li>
      </ul>
      <p class="banquan">
       数盟社区        ，
        做最棒的数据科学社区
      </p>
     </div>
     <div class="left">
      <ul class="bottomlist">
       <li>
        <a href="http://weibo.com/DataScientistUnion  " target="_blank" 　title="">
         <img src="http://dataunion.org/wp-content/themes/yzipi/images/weibo.png"/>
        </a>
       </li>
       <li>
        <a class="cd-popup-trigger" href="http://dataunion.org/17335.html#0">
         <img src="http://dataunion.org/wp-content/themes/yzipi/images/weixin.png"/>
        </a>
       </li>
      </ul>
      <div class="cd-popup">
       <div class="cd-popup-container">
        <h1>
         扫描二维码,加微信公众号
        </h1>
        <img src="http://dataunion.org/wp-content/themes/yzipi/images/2014-12-06-1515289049.png"/>
        <a class="cd-popup-close" href="http://dataunion.org/17335.html">
        </a>
       </div>
       <!-- cd-popup-container -->
      </div>
      <!-- cd-popup -->
     </div>
    </div>
    <!--about-->
    <div class="bottom">
     <a href="http://dataunion.org/">
      数盟社区
     </a>
     <a href="http://www.miitbeian.gov.cn/" rel="external nofollow" target="_blank">
      京ICP备14026740号
     </a>
     联系我们：
     <a href="mailto:contact@dataunion.org" target="_blank">
      contact@dataunion.org
     </a>
     <div class="tongji">
     </div>
     <!--bottom-->
     <div class="scroll" id="scroll" style="display:none;">
      ︿
     </div>
    </div>
   </footer>
   <!--dibu-->
  </div>
 </body>
</html>